Conversation
tlively
left a comment
There was a problem hiding this comment.
Would it be possible to add a test showing that this works?
|
Not yet. Plenty more broken before the first standalone+wasmfs test passes... |
|
Presumably this would not be problem is we spit (Except in the case of |
|
We could also split libstandalone into one file per function, yes, if we also made sure to link in wasmfs first and not later. That seems more complicated, though, to me. |
|
I didn't mean to say we shouldn't land this. I think it might be common for folks to want to replace these stub functions so going forward I think splitting up the library could make more sense than marking each of the function in it as weak. Its a fairly common pattern to override a stdlib function by including your own version of it, and the way that libc and other core libraries allow this is by putting each function it its own source file. This change LGTM though. |
|
Sounds good. I do agree that separately splitting up libstandalonewasm is good for the reasons you mentioned. |
|
Landing this to unblock progress with that LGTM. We can change this later if we want. In fact, once wasmfs is the default we could completely erase the syscalls in libstandalonewasm... |
|
Actually, I'm not sure how wasmfs could work with standalone wasm. Wasmfs defines wasi syscalls. What I'd like to do is for wasmfs to intercept those syscalls, then handle them itself if it should - MemFS, in particular - but when going for stdout/stderr we should just forward to the VM's wasi syscalls. So we want wasmfs to "interpose" here. Is that possible (without JS)? |
|
Yes I think we can do it. We could define e.g.: This would be an alternative import to one defined in |
Both libwasmfs and libstandalonewasm implement the open syscall, as well as
others (only the first is in this PR). I think we should make them weak in
standalone wasm, that is, if wasmfs is present we always want to run that code.
The wasmfs syscall will then call lower-level things which we will need to implement
in standalone wasm (like we do in JS).